<div class="crumb-wrap">
    <div class="crumb-list"><i class="icon-font"></i><a href="<?=site_url('admini')?>">首页</a>
        <span class="crumb-step">&gt;</span><span class="crumb-name">商家管理</span>
    </div>
</div>
        <div class="search-wrap">
            <div class="search-content">
                <form action="<?=site_url('admini/store/index');?>" method="get">
                    <table class="search-tab">
                        <tr>
                            <th width="70">搜索:</th>
                            <td><input class="common-text" placeholder="输入商家名称搜索" name="keys" value="<?=empty($_GET['keys']) ? '' : $_GET['keys']?>" id="" type="text"></td>
                            <td><input class="btn btn-primary btn2" value="查询" type="submit"></td>
                            <td><a class="btn btn-primary btn2" onclick="location.href='<?=site_url('admini/store/index')?>'">重置</a></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
        <div class="result-wrap">
            <form name="myform" id="myform" method="post">
                <div class="result-title">
                    <div class="result-list">
                        <a href="<?=site_url('admini/store/create')?>"><i class="icon-font"></i>添加商铺</a>
                        <!-- <a id="batchDel" href="javascript:void(0)"><i class="icon-font"></i>批量删除</a>
                        <a id="updateOrd" href="javascript:void(0)"><i class="icon-font"></i>更新排序</a> -->
                    </div>
                </div>
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>
                            <th>ID</th>
                            <th>商铺名称</th>
                            <th>联系人</th>
                            <th>联系电话</th>
                            <th>创建时间</th>
                            <th>所有商品</th>
                            <th title="每年1月1日清零">销量/营业额（年）</th>
                            <th title="每月1日清零">销量/营业额（月）</th>
                            <th>操作</th>
                        </tr>
                        <?php foreach($list as $k => $v):?>
                        <tr title='<?=$v['introduce']?>'>
                            <td><?=$v['id']?></td>
                            <td title="点击查看该商铺商品"><a href="<?=site_url('admini/goods/index?store='.$v['id'])?>"><?=$v['s_name']?></a></td>
                            <td><?=$v['contact']?></td>
                            <td><?=$v['phone']?></td>
                            <td><?=date('Y-m-d',$v['create_time'])?></td>
                            <td><?=$v['goods_count']?></td>
                            <td>5/5000</td>
                            <td>3/3000</td>
                            <td>
                                
                                <a class="link-update" href="<?=site_url('admini/store/update?sid='.$v['id'])?>">修改</a>
                                <?php if($v['id'] != 1):?>
                                <a class="link-del" href="javascript:del_store('<?=$v['id']?>');">删除</a>
                                <a class="link-update" href="<?=site_url('admini/suser/index?sid='.$v['id'])?>">商铺管理员</a>
                                <?php endif;?>
                            </td>
                        </tr>
                        <?php endforeach;?>
                    </table>
                    <div class="list-page"> <?=$page?></div>
                </div>
            </form>
        </div>
<script type="text/javascript">
    function del_store(sid){
        layer.confirm('删除该商铺会删除下面的用户和所有商品。', {
            btn: ['删除','取消'], //按钮
            shade: false //不显示遮罩
        }, function(){
            $.post("<?=site_url('admini/store/delete')?>",{sid:sid},function(res){
                if(res == 1){
                    location.reload(true);
                }else{
                    layer.alert(res,{
                        icon:2,
                    });
                }
            });
        });
        
    }

</script>